<%@ tag pageEncoding="UTF-8"%>
<%@ attribute name="page" required="true" type="cn.org.rapid_framework.page.Page" description="Page.java" %>
<%@ attribute name="pageSizeSelectList" type="java.lang.Number[]" required="false"  %>
<%@ attribute name="isShowPageSizeList" type="java.lang.Boolean" required="false"  %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
	// set default values
	Integer[] defaultPageSizes = new Integer[]{10,15,20,25,30,40,50,100};
	if(jspContext.getAttribute("pageSizeSelectList") == null) {
		jspContext.setAttribute("pageSizeSelectList",defaultPageSizes); 
	}
	
	if(jspContext.getAttribute("isShowPageSizeList") == null) {
		jspContext.setAttribute("isShowPageSizeList",true); 
	} 
%>

<table width="100%">
	<tr>
	    <td align="left">
	    	&nbsp;共&nbsp;<span>${page.totalCount}</span>&nbsp;条记录 当前页面是第&nbsp;<span>${page.thisPageNumber}</span>&nbsp;页 共&nbsp;<span>${page.lastPageNumber}</span>&nbsp;页
	    </td>
	    <td align="right">
            <span class='l12'>每页&nbsp;
            	<c:if test="${isShowPageSizeList}">
					<select id='pageSize' name='pageSize' width='25px' onchange="Milan.goPage(this,'${page.thisPageNumber}','','')">
						<c:forEach var="item" items="${pageSizeSelectList}">
							<option value="${item}" ${page.pageSize == item ? 'selected' : '' }>${item}</option>
						</c:forEach> 
					</select>
				</c:if>
            &nbsp;条记录</span>
            <c:choose>
				<c:when test="${page.firstPage}"></c:when>
				<c:otherwise><input type='button' class='hrefButton' onclick="Milan.queryData(this,'1','')" value='首页'></c:otherwise>
			</c:choose>
			
			<c:choose>
				<c:when test="${page.hasPreviousPage}"><input type='button' class='hrefButton' onclick="Milan.queryData(this,'${page.previousPageNumber}','')" value='上一页'></c:when>
				<c:otherwise></c:otherwise>
			</c:choose>
			
			<c:choose>
				<c:when test="${page.hasNextPage}"><input type='button' class='hrefButton' onclick="Milan.queryData(this,'${page.nextPageNumber}','')" value='下一页'></c:when>
				<c:otherwise></c:otherwise>
			</c:choose>
			
			<c:choose>
				<c:when test="${page.lastPage}"></c:when>
				<c:otherwise><input type='button' class='hrefButton' onclick="Milan.queryData(this,'${page.lastPageNumber}','')" value='末页'></c:otherwise>
			</c:choose>
			<span class='l12'>转到&nbsp;
				<select id='pageNumber' name='pageNumber' width='25px' onchange="Milan.goPage(this,'${page.thisPageNumber}','','')">
					<c:forEach var="item" begin="1" end="${page.lastPageNumber}" >
						<option value="${item}" ${item == page.thisPageNumber ? 'selected' : ''}>${item}</option>
					</c:forEach>
				</select>
			&nbsp;页</span>
        </td>
	</tr>
</table>		        
